import request from "../utils/request";

export function login(username, password) {
    return request({
        url: '/login',
        method: 'post',
        headers: {
            isToken: false
        },
        data: {
            'username': username,
            'password': password
        }
    })
}
export function logout() {
    return request({
        url: "/logout",
        method: "post",
        headers: {
            isToken: true
        }
    })

}
export function register(data) {
    return request({
        url: '/user/register',
        method: 'post',
        data: data
    })

}
export function getUserInfo() {
    return request({
        url: "/user/userInfo",
        method: "get",
        headers: {
            isToken: true
        }
    })
}
export function getUserInfoById(userId) {
    return request({
        url: "/user/userInfo/byId/" + userId,
        method: "get",
        headers: {
            isToken: true
        }
    })
}
export function updateUserInfo(data) {
    return request({
        url: "/user/userInfo",
        method: "put",
        headers: {
            isToken: true,
            'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryVCFSAonTuDbVCoAN'
        },
        data: data


    })
}